package com.vanvalt.payhui.util.qiniu;

import java.io.IOException;

import com.qiniu.util.Auth;
import com.thinkgem.jeesite.common.config.Global;

/**
 * @author Xiaoyang
 *
 */
public class QiniuUtil {

	
	private String accessKey;
	private String secretKey;
	
	public QiniuUtil(){
	}
	
	public QiniuUtil(String accessKey, String secretKey){
		super();
		this.accessKey = accessKey;
		this.secretKey = secretKey;
	}
	
	/**
	 * 获取上传Token
	 * @return
	 */
	public String getUpToken(){
		
		//密钥配置
		Auth auth = Auth.create(this.accessKey, this.secretKey);
		String bucketname = Global.getConfig("qiniu.config.bucket.name");
		
		return auth.uploadToken(bucketname);
	}
	
	public static void main(String args[]) throws IOException{  
	    
		String accessKey = "";
		String secretKey = "";
		
		new QiniuUtil(accessKey, secretKey).getUpToken();
	}

	
}
